<?php
	session_start();
	
	if(!$_SESSION['cadastro']){
		$_SESSION['cadastro']['nome']			=	'';
		$_SESSION['cadastro']['sexo']			=	'';
		$_SESSION['cadastro']['endereco']		=	'';
		$_SESSION['cadastro']['cidade']			=	'';
		$_SESSION['cadastro']['estado']			=	'';
		$_SESSION['cadastro']['telefone']		=	'';
		$_SESSION['cadastro']['nascimento']		=	'';
		$_SESSION['cadastro']['idCurso']		=	'';
		$_SESSION['cadastro']['email']			=	'';
		$_SESSION['cadastro']['graduacao']		=	'';
		$_SESSION['cadastro']['interesse']		=	'';
		$_SESSION['cadastro']['profissao']		=	'';
		$_SESSION['cadastro']['vinculoProfissional']    =	'';
	}
	
	$listaEstados = array ("AC", "AL", "AP", "AM", "BA", "CE", "DF","ES","GO", "MA", "MT", "MS", "MG", "PA", "PB", "PR", "PE", "PI", "RJ",
					       "RN", "RS", "RO", "RR", "SC", "SP", "SE", "TO");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Experi&ecirc;ncias do Processo de Adoecimento</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="vivencias.css" rel="stylesheet" type="text/css">
</head>

<body>
<div align="center">
  <table width="750" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="10%" align="left" valign="top"><img src="imagens/logo.jpg" width="66" height="53"></td>
                  <td width="90%"><img src="imagens/tit1.jpg" width="612" height="28"></td>
                </tr>
              </table></td>
          </tr>
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr align="left" valign="middle">
                  <td width="33%" class="nomecurso">&nbsp;</td>
                  <td width="60%" class="miudo">&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr align="left" valign="middle">
                  <td colspan="2" class="miudo">&nbsp;</td>
                  <td width="1%">&nbsp;</td>
                  <td width="1%">&nbsp;</td>
                  <td width="5%">&nbsp;</td>
                </tr>
              </table></td>
              <form enctype="multipart/form-data" action="cadastro.php" method="post">
          </tr>
          <tr>
            <td align="center" valign="top">
			<table width="70%" border="0" cellpadding="5" cellspacing="1">
                <tr>
                  <td><a href="cadastrar.htm" class="miudo">voltar</a></td>
                </tr>
                <tr>
                  <td bgcolor="578e87" class="titprincipal">Formul&aacute;rio
                    de cadastro para VISITANTE</td>
                </tr>
                <tr>
                  <td align="center" valign="middle" class="texto2"><table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#FFFFFF">
                      <tr bgcolor="5fc49a" class="texttab">
                        <td align="right" valign="top"> <div align="left" class="branco"></div>
                          <span class="texto"> Nome</span></td>
                        <td width="2%">&nbsp;</td>
                        <td class="texto"> <input name="nome" type="text" size="49" value="<?php echo $_SESSION['cadastro']['nome'];?>">
                        </td>
                      </tr>
                      <tr bgcolor="f1fef9" class="texttab">
                        <td valign="middle"> <div align="right">
                            <p class="texto">Forma&ccedil;&atilde;o</p>
                          </div></td>
                        <td>&nbsp;</td>
                        <td width="41%" valign="middle" class="texto"> <input name="graduacao" type="text" size="30" value="<?php echo $_SESSION['cadastro']['graduacao'];?>"></td>
                      </tr>
                      <tr bgcolor="f1fef9" class="texttab">
                        <td valign="middle"> <div align="right">
                            <p class="texto">V&iacute;nculo profissional</p>
                          </div></td>
                        <td>&nbsp;</td>
                        <td valign="middle" class="texto"> <input name="vinculoProfissional" type="text" size="30" value="<?php echo $_SESSION['cadastro']['vinculoProfissional'];?>"></td>
                      </tr>
                      <tr bgcolor="f1fef9" class="texttab">
                        <td valign="middle"> <div align="right">
                            <p class="texto">Nascimento</p>
                          </div></td>
                        <td>&nbsp;</td>
                        <td valign="middle" class="texto"> <input name="nascimento" type="text" size="10" maxlength="10" value="<?php echo $_SESSION['cadastro']['nascimento'];?>">&nbsp;&nbsp;<span class="miudo">dd/mm/aaaa</span></td>
                      </tr>
                      <tr bgcolor="f1fef9" class="texttab">
                        <td valign="middle"> <div align="right">
                            <p class="texto">Sexo</p>
                          </div></td>
                        <td>&nbsp;</td>
                        <td valign="middle" class="texto"> <input type="radio" name="sexo" value="Feminino" <?php if ($_SESSION['cadastro']['sexo'] == 'Feminino') echo "checked='checked'";?>>
                          Feminino
                          <input type="radio" name="sexo" value="Masculino" <?php if ($_SESSION['cadastro']['sexo'] == 'Masculino') echo "checked='checked'";?>>
                          Masculino</td>
                      </tr>
                      <tr bgcolor="f1fef9" class="texttab">
                        <td valign="middle"> <div align="right">
                            <p class="texto">Endere&ccedil;o</p>
                          </div></td>
                        <td>&nbsp;</td>
                        <td valign="middle" class="texto"> <input name="endereco" type="text" size="50" value="<?php echo $_SESSION['cadastro']['endereco'];?>"></td>
                      </tr>
                      <tr bgcolor="f1fef9" class="texttab">
                        <td valign="middle"> <div align="right">
                            <p class="texto">Cidade</p>
                          </div></td>
                        <td>&nbsp;</td>
                        <td valign="middle" class="texto"> <input name="cidade" type="text" size="50" value="<?php echo $_SESSION['cadastro']['cidade'];?>"></td>
                      </tr>
                      <tr bgcolor="f1fef9" class="texttab">
                        <td valign="middle"> <div align="right">
                            <p class="texto">Estado</p>
                          </div></td>
                        <td>&nbsp;</td>
                        <td valign="middle" class="texto"> 
                        	<select name="estado" id="estado">
                        	<option value="--">--</option>
							<?php 
								for($i = 0; $i < sizeof($listaEstados); $i++){
							?>
                        	<option value="<?php echo $listaEstados[$i];?>" <?php if($_SESSION['cadastro']['estado'] == $listaEstados[$i]){?> selected="selected" <?php } ?>><?php echo $listaEstados[$i];?></option>
							<?php } ?>
							</select>
                        </td>
                      </tr>
                      <tr bgcolor="f1fef9" class="texttab">
                        <td valign="middle"> <div align="right">
                            <p class="texto">Telefone</p>
                          </div></td>
                        <td>&nbsp;</td>
                        <td valign="middle" class="texto"> <input name="telefone" type="text" size="10" maxlength="10" value="<?php echo $_SESSION['cadastro']['telefone'];?>"></td>
                      </tr>
                      <tr bgcolor="f1fef9" class="texttab">
                        <td valign="middle"> <div align="right">
                            <p class="texto">E-mail</p>
                          </div></td>
                        <td valign="top">&nbsp;</td>
                        <td valign="middle" class="texto"> <input name="email" type="text" size="50" maxlength="100" value="<?php echo $_SESSION['cadastro']['email'];?>"></td>
                      </tr>
                      <tr bgcolor="f1fef9" class="texttab">
                        <td align="right" valign="middle" class="texto">Senha</td>
                        <td valign="top">&nbsp;</td>
                        <td valign="middle" class="texto"> <input name="senha" type="password" size="30" maxlength="50"></td>
                      </tr>
                      <tr bgcolor="f1fef9" class="texttab">
                        <td align="right" valign="middle" class="texto">Confirmar
                          senha </td>
                        <td valign="top">&nbsp;</td>
                        <td valign="middle" class="texto"> <input name="confirmaSenha" type="password" size="30" maxlength="50"></td>
                      </tr>
                      <tr bgcolor="f1fef9" class="texttab">
                        <td align="right" valign="middle" class="texto">Inserir
                          foto </td>
                        <td valign="top">&nbsp;</td>
                        <td valign="middle" class="texto"> <input type="file" name="foto" value="Procurar arquivo">
                      <tr bgcolor="f1fef9" class="texttab">
                        <td valign="middle"> <div align="right">
                        	<input type="hidden" value="4" name="idTipoUsuario">
			 				<input type="hidden" value="0" name="tipoCadastro">
                            <p class="texto">Qual o seu interesse em visitar o
                              site? </p>
                          </div></td>
                        <td valign="top">&nbsp;</td>
                        <td valign="middle" class="texto"> <textarea name="interesse" cols="50"><?php echo $_SESSION['cadastro']['interesse'];?></textarea>
                        </td>
                      </tr>

                       <tr bgcolor="f1fef9" class="texttab">
                        <td align="right" valign="middle" bgcolor="f1fef9" class="texto">Curso
                          a ser inscrito</td>
                        <td valign="top">&nbsp;</td>
                        <td valign="middle" class="texto"><select name="cursos">
			 			 <option value="">-</option>
                          <?php
							include("/var/www/html/vivencias/conexaoBD.php");
			
							$query = "SELECT nome,idCurso FROM cursos WHERE dataTermino > CURDATE()";
							$resultado = mysql_query($query,$conexao);
							while($objeto = mysql_fetch_object($resultado)){

                  	  	  ?>
                          <option value="<?php echo $objeto->idCurso; ?>" <?php if ($_SESSION['cadastro']['idCurso'] == $objeto->idCurso) echo "selected";?>><?php echo $objeto->nome; } ?></option>
                          </select></td>
                      </tr>

                      <tr bgcolor="f1fef9" class="texttab">
                        <td valign="middle">&nbsp;</td>
                        <td valign="top">&nbsp;</td>
                        <td valign="middle" class="texto"> <input type="submit" name="Submit" value="Enviar"></td>
                      </tr>
                    </table></form></td>
                </tr>
                <tr>
                  <td class="titvermelho">&nbsp;</td>
                </tr>
                <tr>
                  <td class="texto2">&nbsp;</td>
                </tr>
              </table>
              <p align="center">&nbsp;</p></td>
          </tr>
        </table></td>
    </tr>
  </table>
  <p>&nbsp;</p>
</div>
</body>
</html>
<?php unset($_SESSION['cadastro']);?>
